# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=swig
pkgver=4.0.2
pkgrel=0
pkgdesc="A compiler that makes it easy to integrate C and C++ code with scripting languages"
url="http://www.swig.org/"
arch="all"
license="GPL-3.0-only"
depends="guile"
makedepends="zlib-dev pcre-dev bison"
checkdepends="boost-dev perl-dev python3-dev diffutils"
subpackages="$pkgname-doc"
source="https://downloads.sourceforge.net/swig/swig-$pkgver.tar.gz
	fix-test-sed-PATH.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-python3=/usr/bin/python3
	make
}

check() {
	(
#	export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
	env
	make -C CCache check
	)
}

package() {
	make DESTDIR="$pkgdir" install
	install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	install -D -m644 LICENSE-UNIVERSITIES "$pkgdir"/usr/share/licenses/$pkgname/LICENSE-UNIVERSITIES
}

sha512sums="05e7da70ce6d9a733b96c0bcfa3c1b82765bd859f48c74759bbf4bb1467acb1809caa310cba5e2b3280cd704fca249eaa0624821dffae1d2a75097c7f55d14ed  swig-4.0.2.tar.gz
62d6eecba01abe8ddd5a3b8a5512b57e63182b49d957bb81903c29dfccfaa62e75555dabc2c7b163afb8432328dd10e23bec0e3bf1d1d7622ec1119f5dab0a64  fix-test-sed-PATH.patch"
